<?php
if (isset($_SESSION['rang']) != 1) {
    header('Location:index.php');
} else {
    ?>
    <div class="col-lg-8">
        <h2>Liste des utilisateurs</h2>

        <table class="table table-bordered table-condensed">
            <tr class="alert-warning">
                <td>Login</td>
                <td>Password</td>
                <td>Date d'Inscription</td>
                <td>Rang</td>
                <td>Modification</td>
                <td>Suppression</td>
            </tr>

            <?php
            foreach (VariablesGlobales::$lesUsers as $nb => $unUser) {
                if ($unUser->rang == 0)
                    $rang = "Utilisateur";
                else
                    $rang = "Administrateur";

                //Affichage des informations
                echo "<tr><td>$unUser->login</td>";
                echo "<td>$unUser->password</td>";
                echo "<td>$unUser->dateInscription</td>";
                echo "<td>$rang</td>";
                echo "<td><center><a href='?controleur=User&action=modifier&id=$unUser->id' class='glyphicon glyphicon-edit'></a></center></td>";
                echo "<td><center><a href='?controleur=User&action=supprimer&id=$unUser->id' class='glyphicon glyphicon-remove'></a></center></td></tr>";
            }
            ?>
        </table>
    </div>
    <?php
}
?>